package cn.com.netedge.iot.common.constants;

import cn.com.netedge.iot.common.mq.MqMessageListener;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;

public class MqConstants {
    public static final String QUEUE_DOWN_MESSAGE = "queue.down.message";
    public static final String QUEUE_UP_MESSAGE_NORMAL = "queue.up.message.normal";
    public static final String QUEUE_UP_MESSAGE_EMERGENCY = "queue.up.message.emergency";
    public static final String QUEUE_DATA_POWER_CUMULATIVE_READING = "queue.data.power.cumulative.reading";

    private static ConcurrentHashMap<String, AtomicLong> messageCountMap = new ConcurrentHashMap<>();
    public static Map<String, MqMessageListener> mqListenerMap = new ConcurrentHashMap<>(); // 消费者map, key = queuename

    public static void putMessageCount(String key, AtomicLong messageCount) {
        messageCountMap.put(key, messageCount);
    }

    public static AtomicLong getMessageCount(String key) {
        return messageCountMap.get(key);
    }

    public static boolean containsMqMessageListener(String queueName) {
        return mqListenerMap.containsKey(queueName);
    }
}
